gtkentry: Return early from gtk_entry_clear() if no icon info exists
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Wed, 20 Nov 2013 17:30:22 +0000 (17:30 +0000)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Mon, 9 Mar 2015 13:41:37 +0000 (13:41 +0000)
This helps scan-build avoid some false positive potential NULL pointer
dereference warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=712760

gtk/gtkentry.c

index d3f2ab58b959a09e6379cd7a1245735dd0e882f7..c0b9d4343fb7242ba6ee5dab1d57380796ffd018 100644 (file)
@@ -7437,7 +7437,10 @@ gtk_entry_clear (GtkEntry             *entry,
   EntryIconInfo *icon_info = priv->icons[icon_pos];
   GtkImageType storage_type;
 
-  if (icon_info && _gtk_icon_helper_get_is_empty (icon_info->icon_helper))
+  if (icon_info == NULL)
+    return;
+
+  if (_gtk_icon_helper_get_is_empty (icon_info->icon_helper))
     return;
 
   g_object_freeze_notify (G_OBJECT (entry));